<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * 数据类型
         */ 
        // 基础数据类型
        // var name = 'tom'
        // var name = "tom"
        var name = `tom`

        var age = 20
        var height = 183.5
        // console.log(typeof height)

        // console.log(age - name) // NaN

        let flag = true
        // console.log(typeof flag)

        var address = null
        var hobby // undefined

        // console.log(address)
        // console.log(hobby) 
        // console.log(sex) // 报错：sex is not defined

        // console.log(name, age, height)

        // 数据类型转换
        // var str = age + ''
        // console.log(Boolean(name))
        // console.log(Boolean('hello'))
        // console.log(Boolean(''))

        // console.log(Boolean(25))
        // console.log(Boolean(0))

        // console.log(Boolean(null))
        // console.log(Boolean(undefined))
        // console.log(Boolean(NaN))


        /**
         * 运算符
         */ 
        var a = 2
        var b = 5
        var c = '2'

        // console.log(a**b) // 求幂/次方

        // console.log(a==c) // 等于，只判断值是否相等
        // console.log(a===c) // 全等于

        /**
         * 循环
         */ 
        var names = ['tom', 'jerry', 'lucy', 'lili']
        // for(var name of names){
        //     console.log(name)
        // }

        for(var index in names){
            console.log(index, names[index])
        }
    </script>
</body>
</html>